package dao

import (
	"cms/model"
	"errors"
	"github.com/sirupsen/logrus"
	"github.com/wdaglb/korm"
)

// GetAdminByUsername 根据账户获取管理信息
func GetAdminByUsername(username string, data *model.Admin) error {
	db := korm.NewContext()
	if err := db.Model(&data).Where("Username", username).Find().Error; err != nil {
		if !errors.Is(err, korm.ErrRecordNotFound) {
			logrus.Errorf("db: %v", err)
		}
		return err
	}
	return nil
}
